home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Windows / Window.h < prev    next >
Text File  |  1997-06-28  |  3KB  |  140 lines

  1. // Window.h
  2.  
  3. #ifndef Window_h
  4. #define Window_h
  5.  
  6. #ifndef AbstractWindow_h
  7. #include "AbstractWindow.h"
  8. #endif
  9. #ifndef WindowController_h
  10. #include "WindowController.h"
  11. #endif
  12. #ifndef WindowDefaults_h
  13. #include "WindowDefaults.h"
  14. #endif
  15. #ifndef WindowObject_h
  16. #include "WindowObject.h"
  17. #endif
  18. #ifndef RootPane_h
  19. #include "RootPane.h"
  20. #endif
  21. #ifndef SimpleProxy_h
  22. #include "SimpleProxy.h"
  23. #endif
  24. #ifndef WindowLocator_h
  25. #include "WindowLocator.h"
  26. #endif
  27. #ifndef WindowFocus_h
  28. #include "WindowFocus.h"
  29. #endif
  30. #ifndef GrafPortContext_h
  31. #include "GrafPortContext.h"
  32. #endif
  33. #ifndef ContextFree_h
  34. #include "ContextFree.h"
  35. #endif
  36. #ifndef Closing_h
  37. #include "Closing.h"
  38. #endif
  39. #ifndef Receiver_h
  40. #include "Receiver.h"
  41. #endif
  42. #ifndef PreparingToQuit_h
  43. #include "PreparingToQuit.h"
  44. #endif
  45. #ifndef PreparingToClose_h
  46. #include "PreparingToClose.h"
  47. #endif
  48. #ifndef CommandLink_h
  49. #include "CommandLink.h"
  50. #endif
  51.  
  52. class WindowInitializer;
  53. class WindowDefinition;
  54.  
  55. class Window: public ContextFree,
  56.                   public WindowController,
  57.                   public WindowDefaults,
  58.                   public Receiver<PreparingToQuit>,
  59.                   public Closing,
  60.                   public Broadcaster<PreparingToClose>,
  61.                   private AbstractWindow
  62.   {
  63.     private:
  64.         const WindowDefinition& definition;
  65.         WindowObject window;
  66.         WindowFocus focus;
  67.         RootPane pane;
  68.         String255 nameString;
  69.         GrafPortContext context;
  70.         WindowLocator::Registration registration;
  71.         CommandLink<Closing> closingLink;
  72.         
  73.         SimpleProxy<Window,bool> visibility;
  74.         SimpleProxy<Window,bool> zoomed;
  75.         SimpleProxy<Window,Rectangle> bounds;
  76.         SimpleProxy<Window,ConstPString> name;
  77.         SimpleProxy<Window,uint32> index;
  78.     
  79.     protected:
  80.         virtual void Update();
  81.         
  82.         virtual void Activate();
  83.         virtual void Deactivate();
  84.         
  85.         virtual void ClickContent( const MouseDownEvent& );
  86.         virtual void ClickDrag( const MouseDownEvent& );
  87.         virtual void ClickClose( const MouseDownEvent& );
  88.         virtual void ClickZoomIn( const MouseDownEvent& );
  89.         virtual void ClickZoomOut( const MouseDownEvent& );
  90.         virtual void ClickGrow( const MouseDownEvent& );
  91.     
  92.         bool GetVisibility() const;
  93.         virtual void SetVisibility( bool );
  94.         
  95.         bool GetZoomed() const;
  96.         virtual void SetZoomed( bool );
  97.         
  98.         Rectangle GetBounds() const;
  99.         virtual void SetBounds( Rectangle );
  100.         
  101.         ConstPString GetName() const;
  102.         virtual void SetName( ConstPString );
  103.         
  104.         uint32 GetIndex() const;
  105.         virtual void SetIndex( uint32 );
  106.         
  107.     public:
  108.         Window( const WindowDefinition& );
  109.         virtual ~Window();
  110.         
  111.         void Initialize( const WindowInitializer& );
  112.         
  113.         WindowFocus& Focus()                                { return focus; }
  114.         const WindowFocus& Focus() const                { return focus; }
  115.         
  116.         GrafPortContext& Context()                        { return context; }
  117.         const GrafPortContext& Context() const        { return context; }
  118.  
  119.         virtual GDHandle DefaultScreen() const;
  120.         virtual Rectangle DefaultPosition( GDHandle screen ) const;
  121.         
  122.         Pane& RootPane()                                    { return pane; }
  123.         const Pane& RootPane() const                    { return pane; }
  124.         
  125.         virtual bool CanClose() const;
  126.         virtual void Close( SavingOption save = SavingOption::ask );
  127.         virtual void PrepareToQuit( SavingOption );
  128.         
  129.         virtual GDHandle BestScreen() const;
  130.         virtual Rectangle BestBounds() const;
  131.         virtual Rectangle BestBounds( GDHandle screen ) const;
  132.         virtual Rectangle BestBounds( Rectangle available ) const;
  133.         
  134.         virtual Rectangle AvailableArea( GDHandle ) const;
  135.         
  136.         void SetContext()                                    { context.BeCurrent(); }
  137.   };
  138.  
  139. #endif
  140.